import 'package:boss/color_constant.dart';
import 'package:boss/models/order_header.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/shadow_radius_card.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

class OrderStatusCard extends StatelessWidget {
  final OrderType data;
  final bool isSelected;
  final VoidCallback onTap;

  const OrderStatusCard({
    Key key,
    @required this.data,
    this.isSelected = false,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Widget child = Column(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        Text(
          data.des,
          style: isSelected
              ? TextStyleConstant().white_28
              : TextStyleConstant().normal_1_28,
        ),
        RichText(
          text: TextSpan(
              text: '${data.num}',
              style: isSelected
                  ? TextStyleConstant().white_36
                  : TextStyleConstant().normal_1_36,
              children: [
                TextSpan(
                  text: '单',
                  style: isSelected
                      ? TextStyleConstant().white_22
                      : TextStyleConstant().normal_1_22,
                ),
              ]),
        ),
      ],
    );

    if (isSelected) {
      child = Container(
        width: 160.w,
        height: 160.w,
        decoration: BoxDecoration(
          color: ColorConstant.ff5770f6,
          borderRadius: BorderRadius.circular(
            14.w,
          ),
        ),
        child: child,
      );
    } else {
      child = ShadowRadiusCard(
        width: 160.w,
        height: 160.w,
        child: child,
      );
    }

    return GestureDetector(
      child: child,
      onTap: onTap,
    );
  }
}
